home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / Metric.h < prev    next >
C/C++ Source or Header  |  1992-06-09  |  1KB  |  76 lines

  1. #ifndef Metric_First
  2. #ifdef __GNUG__
  3. //pragma once
  4. #pragma interface
  5. #endif
  6. #define Metric_First
  7.  
  8. #include "Point.h"
  9.  
  10.  
  11. class Metric {
  12. public:
  13.     Point extent;
  14.     int base;
  15.  
  16. public:
  17.  
  18.     Metric();
  19.     
  20.     Metric(Point e, int b);
  21.     
  22.     Metric(Point e);
  23.  
  24.     Metric(int w);
  25.  
  26.     Metric(int w, int h);
  27.     
  28.     Metric(int w, int h, int b);
  29.  
  30.     Metric(const Metric&);
  31.  
  32.     Point Extent()
  33.     { return extent; }
  34.     
  35.     int Width()
  36.     { return extent.x; }
  37.     
  38.     int Height()
  39.     { return extent.y; }
  40.     
  41.     int Base()
  42.     { return base; }
  43.     
  44.     Metric Inset(Point);
  45.     
  46.     Metric Expand(Point);
  47.     
  48.     Metric Merge(const Metric&);
  49.     Metric Cat(Direction d, const Metric &m, const Point &gap);
  50.     
  51.     operator Point()
  52.        { return extent; }
  53.     
  54.     friend Metric HCat(const Metric&, const Metric&, int hgap= 0);
  55.     friend Metric VCat(const Metric&, const Metric&, int vgap= 0);
  56.     friend Metric Cat(Direction d, const Metric&, const Metric&, Point gap);
  57.  
  58.     friend bool operator== (const Metric &m1, const Metric &m2)
  59.     { return (bool) (m1.extent == m2.extent && m1.base == m2.base); }
  60.  
  61.     friend bool operator!= (const Metric &m1, const Metric &m2)
  62.     { return (bool) (m1.extent != m2.extent && m1.base != m2.base); }
  63.  
  64.     friend Metric Min (const Metric&, const Metric&);
  65.  
  66.     friend Metric Max (const Metric&, const Metric&);        
  67.  
  68.     friend OStream& operator<< (OStream &s, const Metric &p);
  69.     friend IStream& operator>> (IStream &s, Metric &p);
  70. };
  71.  
  72. SimpleMetaDef(Metric);
  73.  
  74.  
  75. #endif
  76.